package cn.znk.kedis.master_slave_model.autoconfigure;

import cn.znk.kedis.master_slave_model.template.KedisTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * IntelliJ IDEA
 * project: kedis-spring-boot-starter
 *
 * @author shimi
 * @since 2021/11/22
 * @version 1.0.0
 */
@Configuration
public class KedisTemplateAutoConfiguration {

    @Autowired
    @Qualifier("masterRedisTemplate")
    private RedisTemplate w;

    @Autowired
    @Qualifier("slaveRedisTemplate")
    private RedisTemplate r;

    @Bean
    public KedisTemplate kedisTemplate() {
        return new KedisTemplate<>(w,r);
    }

}
